<template>
	<view>
		<view class="" style="height: 1rpx;width: 1rpx;"></view>
		<view class="code">
			<view class="input_box z-padding-32 z-margin-32 z-radius-24">
				<input type="text" placeholder="请输入你的口令" v-model="code" />
			</view>

			<view class="rule text_999" @tap="rule">兑换规则 >></view>
			<view class="btn-box z-padding-lr-32 z-padding-t-32" :style="'padding-bottom:' + safeBottom">
				<view class="z-btn" @tap="couponTap">兑换</view>
			</view>
		</view>
	</view>
</template>

<script>
import http from '../../utils/http';

export default {
	data() {
		return {
			code: '',
			safeBottom: `30px`,
			exchange_info_id:uni.getStorageSync('config').exchange_info_id
		};
	},
	methods: {
		rule() {
			this.util.skip(`/service/info/info?id=${this.exchange_info_id}&name=兑换规则`);
		},
		couponTap(e) {
			console.log(e);
			http.get('coupon/receive', {
				type: 1,
				code: this.code
			}).then((res) => {
				util.toast(res.msg);
			});
		}
	}
};
</script>

<style>
	page {
		background-color: #EDF1F4;
	}
.input_box {
	background-color: #f5f7f9;
	box-sizing: border-box;
}
.rule {
	display: flex;
	align-items: center;
	justify-content: center;
}

.btn-box {
	position: fixed;
	background: #fff;
	width: 100%;
	box-sizing: border-box;
	bottom: 0;
}
</style>
